home *** CD-ROM | disk | FTP | other *** search
- Path: castle.nando.net!news
- From: actuary@nando.net (Bill McCarthy)
- Newsgroups: comp.lang.c
- Subject: Re: square root
- Date: 17 Mar 1996 18:45:06 GMT
- Organization: Nando.net Public Access
- Message-ID: <4ihmji$4ca@castle.nando.net>
- References: <84210-826932839@mindlink.bc.ca>
- Reply-To: actuary@nando.net (Bill McCarthy)
- NNTP-Posting-Host: grail2113.nando.net
- X-Newsreader: IBM NewsReader/2 v1.2
-
- In <84210-826932839@mindlink.bc.ca>, Kandiah_Ratnavale@mindlink.bc.ca (Kandiah Ratnavale) writes:
- >I am trying to learn C
- >
- >When I try to write a program to calculate a square root, I have included
- >stdio.h and math.h and I get an error message saying
- >
- >"Undefined symbol _sqrt referenced from text segment"
- >
- >and my program does not compile!
- >
- >Can anyone clarify the problem and give me some lead as to what I am doing
- >wrong?
- >
- >I am using the Linux OS in X Windows.
-
- Are you sure it's a compiler error? Does it compile OK with the -c flag (for
- compiile only)? If it does, then you are seeing a link error. There is a bug
- or feature (which didn't make it to the OS/2 port) which requires explicit
- inclusion of the math library. I think this is done by appending a -lm flag
- to the command line invoking the compile/link.
-
- Bill McCarthy
- actuary@nando.net
- Wendell, NC USA
-
-